<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" +request.getServerPort() + path + "/";
%>
<jsp:include page="head.jsp"></jsp:include>    
<!-- 如果直接登陆该页面，则页面转向到控制器 -->
<c:if test="${map.commentList==null }">
<c:redirect url="../ShowMessage_Servlet"></c:redirect>
</c:if>
	<div class="main">
		<h2>留言管理</h2>
		<div class="manage">
			<table class="list">
				<tr>
					<th>ID</th>
					<th>评论者ID</th>
					<th>留言内容</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
				<!-- 循环遍历商品，五个位一页 -->
<c:if test="${map!=null}">
   <c:if test="${map.commentList!=null }">
     <c:forEach items="${map.commentList}" var="obj" varStatus="status">  
                <tr>
					<td class="first w4 c"><c:out value="${obj.leaving_id}"></c:out></td>
					<td class="w1 c"><c:out value="${obj.user_id}"></c:out></td>
					<td><c:out value="${obj.leaving_content}"></c:out></td>	
					<c:choose>
					   <c:when test="${obj.leaving_state==0||obj.leaving_state==null}">
					   <td class="w1 c">未回复</td>
					   <td class="w1 c"><a href="<%=basePath %>manage/guestbook-reply.jsp?id=${obj.leaving_id} &user=${obj.user_id} &leavingContent=${obj.leaving_content}">回复</a>
					   </c:when>
					   <c:otherwise>
					   <td class="w1 c">已回复</td>
					   <td class="w1 c"><a href="<%=basePath %>manage/guestbook-modify.jsp?id=${obj.leaving_id}&user=${obj.user_id}">修改</a>
					   </c:otherwise>
					</c:choose>
					 <a class="manageDel" href="<%=basePath %>ReplyDeleteModifyMessage_Servlet?id=${obj.leaving_id}&manage=delete" class="delete">删除</a></td>
				     
				</tr> 
  </c:forEach>
   </c:if>
</c:if>

			</table>
			<div class="pager">
				 <!-- 分页显示 -->
				<ul class="clearfix">
					<li><a href="<%=basePath %>ShowMessage_Servlet?currentPage=1">首页</a></li>
					<li>
<c:if test="${map.page.currentPage!=1}">
<a href="<%=basePath %>ShowMessage_Servlet?currentPage=${map.page.currentPage-1 }">上一页</a>
</c:if>
                    </li>
                    <li>
<c:if test="${map.page.currentPage!=map.totalPage}">
<a href="<%=basePath %>ShowMessage_Servlet?currentPage=${map.page.currentPage+1 }">下一页</a>
</c:if>
                    </li>
					<li><a href="<%=basePath %>ShowMessage_Servlet?currentPage=${map.totalPage}">尾页</a></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="clear"></div>
</div>
<div id="footer">
	Copyright &copy; 2017 云和学院 All Rights Reserved. 京ICP证1000001号</div>
<script type="text/javascript">
        $(function(){
        	$(".delete").click(function(){
        		$(this).parent().parent().remove();
        		});  	
        });
	</script>
</body>
</html>
